import Vue from 'vue'
import VueRouter from'vue-router'
const login = ()=>import ("@/views/login")
const register = ()=>import ( "@/views/register")
const page404 = ()=>import ( "@/views/exce/404")
const forgetpwd = ()=>import ( "@/views/forget/forgetpassword")
const dashboard = ()=>import ( "@/views/dashboard")
const Device = ()=>import ( "@/components/dashboard/Device")
const Workplace = ()=>import ( "@/components/dashboard/Workplace")
const AppManger =()=>import ( "@/components/dashboard/AppManger")
const Debug = ()=>import ("@/components/dashboard/Debug")
const ClientTest=()=>import ("@/components/dashboard/ClientTest");
const DevDetail = ()=>import ("@/components/dashboard/DevDetail") ;
const addDevForm = ()=>import ("@/components/forms/addDevForm") ;
const Index = ()=>import ("@/components/account/Index") ;
const BaseSetting = ()=>import ("@/components/account/BaseSetting");
const Security =()=> import ("@/components/account/Security");
const Notification= ()=>import ( "@/components/account/Notification");
const Changepwd =()=>import ("@/views/forget/changepassword");
const Files =()=>import ("@/components/dashboard/Files");


Vue.use(VueRouter)

const routes = [
  {path:'/',redirect:login,component:login},
  {path:'/login',name:'login',component: login},
  {path:'/register',name:'register',component:register},
  {path:'/forget',name:'forget',component:forgetpwd},
  {path:'/dashboard',name:'dashboard',component:dashboard,children:[
      {path: '/',redirect:Workplace,component: Workplace},
      {path:'workplace',name:'Workplace',component:Workplace},
      {path:'dev',name:'DevManager',component:Device,children:[
          {path:'detail',name:'Detail',component:DevDetail},
          {path:'add',name:'Add',component: addDevForm}
        ]},
      {path:'app',name:'AppManger',component:AppManger},
      {path:'debug',name:'Debug',component:Debug},
      {path:'test',name:'Test',component:ClientTest},
      {path:'setting',component:Index,children:[
          {path: '/',redirect:'base',component: BaseSetting},
          {path: 'base',name:"BaseSettings",component: BaseSetting},
          {path: 'security',name:'SecuritySettings',component:Security},
          {path: 'notif',name:'NotificationSettings',component:Notification},


        ]}
    ]},
  {path:'/changepassword&e=:email',component:Changepwd},
  {path:'*',name:'404',meta:{title:'页面走丢了'},component:page404},
  {path:'/files',name:'Files',component:Files},
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
